Drop GtkGLArea::has-alpha
authorMatthias Clasen <mclasen@redhat.com>
Wed, 17 Jan 2018 14:22:01 +0000 (09:22 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 17 Jan 2018 17:01:25 +0000 (12:01 -0500)
We now always behave as if has-alpha is TRUE.

Update all callers.

gtk/gtkglarea.c
gtk/gtkglarea.h
tests/gdkgears.c
tests/testglblending.c

index 7a1c17414cb97d34a3e48e6ff8c09e9484110af2..d93edd0c018a6a433938b06670d2d96d09d21725 100644 (file)
@@ -154,7 +154,6 @@ typedef struct {
   guint texture;
   guint depth_stencil_buffer;
 
-  gboolean has_alpha;
   gboolean has_depth_buffer;
   gboolean has_stencil_buffer;
 
@@ -168,7 +167,6 @@ enum {
   PROP_0,
 
   PROP_CONTEXT,
-  PROP_HAS_ALPHA,
   PROP_HAS_DEPTH_BUFFER,
   PROP_HAS_STENCIL_BUFFER,
   PROP_USE_ES,
@@ -219,10 +217,6 @@ gtk_gl_area_set_property (GObject      *gobject,
       gtk_gl_area_set_auto_render (self, g_value_get_boolean (value));
       break;
 
-    case PROP_HAS_ALPHA:
-      gtk_gl_area_set_has_alpha (self, g_value_get_boolean (value));
-      break;
-
     case PROP_HAS_DEPTH_BUFFER:
       gtk_gl_area_set_has_depth_buffer (self, g_value_get_boolean (value));
       break;
@@ -254,10 +248,6 @@ gtk_gl_area_get_property (GObject    *gobject,
       g_value_set_boolean (value, priv->auto_render);
       break;
 
-    case PROP_HAS_ALPHA:
-      g_value_set_boolean (value, priv->has_alpha);
-      break;
-
     case PROP_HAS_DEPTH_BUFFER:
       g_value_set_boolean (value, priv->has_depth_buffer);
       break;
@@ -732,27 +722,6 @@ gtk_gl_area_class_init (GtkGLAreaClass *klass)
                           G_PARAM_STATIC_STRINGS |
                           G_PARAM_EXPLICIT_NOTIFY);
 
-  /**
-   * GtkGLArea:has-alpha:
-   *
-   * If set to %TRUE the buffer allocated by the widget will have an alpha channel
-   * component, and when rendering to the window the result will be composited over
-   * whatever is below the widget.
-   *
-   * If set to %FALSE there will be no alpha channel, and the buffer will fully
-   * replace anything below the widget.
-   *
-   * Since: 3.16
-   */
-  obj_props[PROP_HAS_ALPHA] =
-    g_param_spec_boolean ("has-alpha",
-                          P_("Has alpha"),
-                          P_("Whether the color buffer has an alpha component"),
-                          FALSE,
-                          GTK_PARAM_READWRITE |
-                          G_PARAM_STATIC_STRINGS |
-                          G_PARAM_EXPLICIT_NOTIFY);
-
   /**
    * GtkGLArea:has-depth-buffer:
    *
@@ -1071,60 +1040,6 @@ gtk_gl_area_get_required_version (GtkGLArea *area,
     *minor = priv->required_gl_version % 10;
 }
 
-/**
- * gtk_gl_area_get_has_alpha:
- * @area: a #GtkGLArea
- *
- * Returns whether the area has an alpha component.
- *
- * Returns: %TRUE if the @area has an alpha component, %FALSE otherwise
- *
- * Since: 3.16
- */
-gboolean
-gtk_gl_area_get_has_alpha (GtkGLArea *area)
-{
-  GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
-
-  g_return_val_if_fail (GTK_IS_GL_AREA (area), FALSE);
-
-  return priv->has_alpha;
-}
-
-/**
- * gtk_gl_area_set_has_alpha:
- * @area: a #GtkGLArea
- * @has_alpha: %TRUE to add an alpha component
- *
- * If @has_alpha is %TRUE the buffer allocated by the widget will have
- * an alpha channel component, and when rendering to the window the
- * result will be composited over whatever is below the widget.
- *
- * If @has_alpha is %FALSE there will be no alpha channel, and the
- * buffer will fully replace anything below the widget.
- *
- * Since: 3.16
- */
-void
-gtk_gl_area_set_has_alpha (GtkGLArea *area,
-                           gboolean   has_alpha)
-{
-  GtkGLAreaPrivate *priv = gtk_gl_area_get_instance_private (area);
-
-  g_return_if_fail (GTK_IS_GL_AREA (area));
-
-  has_alpha = !!has_alpha;
-
-  if (priv->has_alpha != has_alpha)
-    {
-      priv->has_alpha = has_alpha;
-
-      g_object_notify (G_OBJECT (area), "has-alpha");
-
-      gtk_gl_area_delete_buffers (area);
-    }
-}
-
 /**
  * gtk_gl_area_get_has_depth_buffer:
  * @area: a #GtkGLArea
index d769a64eb056c310c14dd08805536ac6fe705fed..59d30be1382295d796203577dec5382e20cc7cf8 100644 (file)
@@ -99,11 +99,6 @@ void            gtk_gl_area_get_required_version        (GtkGLArea    *area,
                                                          gint         *major,
                                                          gint         *minor);
 GDK_AVAILABLE_IN_3_16
-gboolean        gtk_gl_area_get_has_alpha               (GtkGLArea    *area);
-GDK_AVAILABLE_IN_3_16
-void            gtk_gl_area_set_has_alpha               (GtkGLArea    *area,
-                                                         gboolean      has_alpha);
-GDK_AVAILABLE_IN_3_16
 gboolean        gtk_gl_area_get_has_depth_buffer        (GtkGLArea    *area);
 GDK_AVAILABLE_IN_3_16
 void            gtk_gl_area_set_has_depth_buffer        (GtkGLArea    *area,
index 94002d5adfe8f7d3c84d8ecb34ef4e089591a6f7..65c4f12fb184c2aec8c7ee6472b01efb94f30746 100644 (file)
@@ -7,14 +7,6 @@
  *                 DEMO CODE                                            *
  ************************************************************************/
 
-static void
-toggle_alpha (GtkWidget *checkbutton,
-              GtkWidget *gears)
-{
-  gtk_gl_area_set_has_alpha (GTK_GL_AREA (gears),
-                             gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(checkbutton)));
-}
-
 static void
 toggle_overlay (GtkWidget *checkbutton,
                GtkWidget *revealer)
@@ -187,13 +179,6 @@ main (int argc, char *argv[])
   g_signal_connect (check, "toggled",
                     G_CALLBACK (toggle_spin), spinner);
 
-  check = gtk_check_button_new_with_label ("Alpha");
-  gtk_box_pack_end (GTK_BOX (hbox), check);
-  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE);
-  gtk_widget_show (check);
-  g_signal_connect (check, "toggled",
-                    G_CALLBACK (toggle_alpha), gears);
-
   check = gtk_check_button_new_with_label ("Overlay");
   gtk_box_pack_end (GTK_BOX (hbox), check);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE);
index 25991c3c6a75b62610ba31036f3d668dba5a1ddd..fea7115582f44ca5112bb70681dcef04657c566f 100644 (file)
@@ -38,12 +38,6 @@ main (int argc, char *argv[])
   gtk_widget_set_size_request (gears, 70, 50);
   gtk_fixed_put (GTK_FIXED (fixed), gears, 60, 100);
 
-  gears = gtk_gears_new ();
-  gtk_gl_area_set_has_alpha (GTK_GL_AREA (gears), TRUE);
-  gtk_widget_set_size_request (gears, 70, 50);
-  gtk_fixed_put (GTK_FIXED (fixed), gears, 120, 100);
-
-
   spinner = gtk_spinner_new ();
   gtk_spinner_start (GTK_SPINNER (spinner));
   gtk_widget_set_size_request (spinner, 50, 50);
@@ -64,12 +58,6 @@ main (int argc, char *argv[])
   gtk_widget_set_size_request (gears, 70, 50);
   gtk_fixed_put (GTK_FIXED (fixed), gears, 60, 130);
 
-  gears = gtk_gears_new ();
-  gtk_gl_area_set_has_alpha (GTK_GL_AREA (gears), TRUE);
-  gtk_widget_set_size_request (gears, 70, 50);
-  gtk_fixed_put (GTK_FIXED (fixed), gears, 120, 130);
-
-
   spinner = gtk_spinner_new ();
   gtk_spinner_start (GTK_SPINNER (spinner));
   gtk_widget_set_size_request (spinner, 50, 50);